/* TabBar 组件样式 - 适配小程序环境 */

.tabbar-container {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: #ffffff;
  border-top: 1px solid #e5e7eb;
  /* 适配小程序安全区域 */
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.1);
}

.tabbar-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 16rpx 0;
  min-height: 120rpx;
}

/* TabBar 项样式 */
.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8rpx;
  padding: 16rpx 24rpx;
  border-radius: 16rpx;
  transition: all 0.2s ease;
  cursor: pointer;
  min-width: 120rpx;

  &:active {
    background-color: rgba(34, 197, 94, 0.1);
    transform: scale(0.95);
  }
}

/* 激活状态 */
.tabbar-item-active {
  background-color: rgba(34, 197, 94, 0.1);

  .tabbar-icon {
    transform: scale(1.1);
  }

  .tabbar-label {
    font-weight: 600;
  }
}

/* 图标样式 */
.tabbar-icon {
  font-size: 48rpx;
  line-height: 1;
  transition: all 0.2s ease;
  display: block;
}

/* 标签文字样式 */
.tabbar-label {
  font-size: 24rpx;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  transition: all 0.2s ease;
  display: block;
}

/* 小屏幕适配 */
@media (max-width: 750rpx) {
  .tabbar-nav {
    padding: 12rpx 0;
    min-height: 100rpx;
  }

  .tabbar-item {
    padding: 12rpx 16rpx;
    gap: 6rpx;
    min-width: 100rpx;
  }

  .tabbar-icon {
    font-size: 40rpx;
  }

  .tabbar-label {
    font-size: 22rpx;
  }
}

/* 超小屏幕适配 */
@media (max-width: 600rpx) {
  .tabbar-item {
    padding: 8rpx 12rpx;
    min-width: 80rpx;
  }

  .tabbar-icon {
    font-size: 36rpx;
  }

  .tabbar-label {
    font-size: 20rpx;
  }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
  .tabbar-container {
    background-color: #1f2937;
    border-top-color: #374151;
    box-shadow: 0 -2rpx 8rpx rgba(255, 255, 255, 0.1);
  }

  .tabbar-item:active {
    background-color: rgba(34, 197, 94, 0.2);
  }

  .tabbar-item-active {
    background-color: rgba(34, 197, 94, 0.2);
  }

  .tabbar-label {
    color: #d1d5db;
  }

  .tabbar-item-active .tabbar-label {
    color: #22c55e;
  }
}

/* 动画效果 */
@keyframes tabBarItemPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.tabbar-item-active .tabbar-icon {
  animation: tabBarItemPulse 0.3s ease-out;
}

/* 徽章样式（预留） */
.tabbar-badge {
  position: absolute;
  top: -8rpx;
  right: -8rpx;
  min-width: 32rpx;
  height: 32rpx;
  background-color: #ef4444;
  color: #ffffff;
  font-size: 20rpx;
  font-weight: bold;
  border-radius: 16rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8rpx;
  box-shadow: 0 2rpx 4rpx rgba(239, 68, 68, 0.3);
}

/* 点击波纹效果 */
.tabbar-item {
  position: relative;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background-color: rgba(34, 197, 94, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
  }

  &:active::before {
    width: 200rpx;
    height: 200rpx;
  }
}

/* 确保文字和图标在波纹效果之上 */
.tabbar-icon,
.tabbar-label {
  position: relative;
  z-index: 1;
}

/* 横屏适配 */
@media (orientation: landscape) and (max-height: 500rpx) {
  .tabbar-nav {
    padding: 8rpx 0;
    min-height: 80rpx;
  }

  .tabbar-item {
    padding: 8rpx 16rpx;
    gap: 4rpx;
  }

  .tabbar-icon {
    font-size: 32rpx;
  }

  .tabbar-label {
    font-size: 18rpx;
  }
}
